﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using sauyou.Utils;

namespace sauyou.Admin
{
    public partial class yhlx_List : ManagePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                chkLoginLevel("viewChannel");
                BindData();
            }
        }

        private void BindData() {
            DataTable dt= DbHelperSQL.Query("SELECT * FROM user_yhlx").Tables[0];
            rptYhlx.DataSource = dt.DefaultView;
            rptYhlx.DataBind();
        }

        //删除操作
        protected void rptYhlx_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            HiddenField hnID = (HiddenField)e.Item.FindControl("hnID");
            switch (e.CommandName.ToLower())
            {
                case "btndel":
                    chkLoginLevel("delArticle");
                    //保存日志
                    SaveLogs("[用户类型]删除类型：" + DbHelperSQL.GetSingle("SELECT name FROM user_yhlx WHERE id='"+hnID.Value+"'"));
                    //删除记录
                    DbHelperSQL.ExecuteSql("delete from user_yhlx where ID='"+hnID.Value+"'");
                    BindData();
                    JscriptPrint("批量删除成功啦！", "", "Success");
                    break;
            }
        }
    }
}
